import { defineStore } from "pinia";
import { Portal } from "@/generated/graphql";
import { has } from "lodash-es";

interface PortalState {
  portal: Portal | undefined;
}

export const usePortalStore = defineStore("portal", {
  state: (): PortalState => ({
    portal: undefined,
  }),
  getters: {
    getRatio(state) {
      if (has(state.portal?.extends, "ratio")) {
        return state.portal?.extends.ratio;
      }
      return undefined;
    },
  },
});
